/* This script created by Fred Smyth, University of Virginia, July 24, 2009, based on the specifications of Tony Greenwald */

libname tonyamp 'C:\Documents and Settings\Fred Smyth\My Documents\consult\greenwald logit regression';  
FILENAME tonyamp 'C:\Documents and Settings\Fred Smyth\My Documents\consult\greenwald logit regression\output';
ODS HTML CLOSE;

/*********************************************************************************/
/* Compute weights to be used in analyses */
/* Weight inversely proportional to distribution (15.8% McCain; 84.2% Obama) */ 
DATA tonyamp.AMP_IAT_voters_only; SET tonyamp.AMP_IAT_voters_only;
 wgtamp = .;
  IF VoteMcCain = 1 THEN wgtamp = 1/.158;
  ELSE IF VoteMcCain = 0 THEN wgtamp = 1/.842;
RUN;

/***********************************************************************************/
  /* UNWEIGHTED LOGISTIC REGRESSION MODELS */
/***********************************************************************************/

TITLE 'DATA = AMP_IAT_voters_only, UNWEIGHTED';
ODS HTML PATH = tonyamp FILE = 'UNWEIGHTEDregressions.html';

TITLE2 'Model 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = race_IATall_d race_AMP_d race_th_df_d attrace_d  
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;

TITLE2 'Model 2';
TITLE3 'Step 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = race_IATall_d race_AMP_d 
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;
TITLE3 'Step 2';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = race_IATall_d race_AMP_d race_th_df_d attrace_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;

TITLE2 'Model 3';
TITLE3 'Step 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = race_th_df_d attrace_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;
TITLE3 'Step 2';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = race_th_df_d attrace_d race_IATall_d race_AMP_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;

TITLE2 'Model 4';
TITLE3 'Step 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = race_th_df_d attrace_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;
TITLE3 'Step 2';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = race_th_df_d attrace_d race_IATall_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;

TITLE2 'Model 5';
TITLE3 'Step 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = race_th_df_d attrace_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;
TITLE3 'Step 2';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = race_th_df_d attrace_d race_AMP_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;

TITLE2 'Model 6';
TITLE3 'Step 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = conservatism_d 
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;
TITLE3 'Step 2';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = conservatism_d race_IATall_d race_AMP_d race_th_df_d attrace_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;

TITLE2 'Model 7';
TITLE3 'Step 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = conservatism_d 
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;
TITLE3 'Step 2';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = conservatism_d race_IATall_d race_AMP_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;

TITLE2 'Model 8';
TITLE3 'Step 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = conservatism_d 
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;
TITLE3 'Step 2';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = conservatism_d attrace_d race_th_df_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;

TITLE2 'Model 9';
TITLE3 'Step 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = symb_racism_d 
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;
TITLE3 'Step 2';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = symb_racism_d race_IATall_d race_AMP_d race_th_df_d attrace_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;

TITLE2 'Model 10';
TITLE3 'Step 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = symb_racism_d 
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;
TITLE3 'Step 2';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = symb_racism_d race_IATall_d race_AMP_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;

TITLE2 'Model 11';
TITLE3 'Step 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = symb_racism_d 
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;
TITLE3 'Step 2';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = symb_racism_d attrace_d race_th_df_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;

TITLE2 'Model 12';
TITLE3 'Step 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = conservatism_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;
TITLE3 'Step 2';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = conservatism_d symb_racism_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;
TITLE3 'Step 3';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = conservatism_d symb_racism_d race_IATall_d race_AMP_d race_th_df_d attrace_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;

TITLE2 'Model 13';
TITLE3 'Step 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = conservatism_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;
TITLE3 'Step 2';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = conservatism_d symb_racism_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;
TITLE3 'Step 3';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = conservatism_d symb_racism_d race_IATall_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; 
RUN;
ODS HTML CLOSE;


/***********************************************************************************/
  /* WEIGHTED LOGISTIC REGRESSION MODELS */
/***********************************************************************************/

TITLE 'DATA = AMP_IAT_voters_only, WEIGHTED';
ODS HTML PATH = tonyamp FILE = 'WEIGHTEDregressions.html';

TITLE2 'Model 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = race_IATall_d race_AMP_d race_th_df_d attrace_d  
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;

TITLE2 'Model 2';
TITLE3 'Step 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = race_IATall_d race_AMP_d 
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;
TITLE3 'Step 2';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = race_IATall_d race_AMP_d race_th_df_d attrace_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;

TITLE2 'Model 3';
TITLE3 'Step 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = race_th_df_d attrace_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;
TITLE3 'Step 2';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = race_th_df_d attrace_d race_IATall_d race_AMP_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;

TITLE2 'Model 4';
TITLE3 'Step 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = race_th_df_d attrace_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;
TITLE3 'Step 2';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = race_th_df_d attrace_d race_IATall_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;

TITLE2 'Model 5';
TITLE3 'Step 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = race_th_df_d attrace_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;
TITLE3 'Step 2';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = race_th_df_d attrace_d race_AMP_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;

TITLE2 'Model 6';
TITLE3 'Step 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = conservatism_d 
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;
TITLE3 'Step 2';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = conservatism_d race_IATall_d race_AMP_d race_th_df_d attrace_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;

TITLE2 'Model 7';
TITLE3 'Step 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = conservatism_d 
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;
TITLE3 'Step 2';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = conservatism_d race_IATall_d race_AMP_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;

TITLE2 'Model 8';
TITLE3 'Step 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = conservatism_d 
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;
TITLE3 'Step 2';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = conservatism_d attrace_d race_th_df_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;

TITLE2 'Model 9';
TITLE3 'Step 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = symb_racism_d 
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;
TITLE3 'Step 2';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = symb_racism_d race_IATall_d race_AMP_d race_th_df_d attrace_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;

TITLE2 'Model 10';
TITLE3 'Step 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = symb_racism_d 
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;
TITLE3 'Step 2';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = symb_racism_d race_IATall_d race_AMP_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;

TITLE2 'Model 11';
TITLE3 'Step 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = symb_racism_d 
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;
TITLE3 'Step 2';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = symb_racism_d attrace_d race_th_df_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;

TITLE2 'Model 12';
TITLE3 'Step 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = conservatism_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;
TITLE3 'Step 2';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = conservatism_d symb_racism_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;
TITLE3 'Step 3';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = conservatism_d symb_racism_d race_IATall_d race_AMP_d race_th_df_d attrace_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;

TITLE2 'Model 13';
TITLE3 'Step 1';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = conservatism_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;
TITLE3 'Step 2';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = conservatism_d symb_racism_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;
TITLE3 'Step 3';
PROC LOGISTIC DATA = tonyamp.AMP_IAT_voters_only DESCENDING;
    MODEL VoteMcCain = conservatism_d symb_racism_d race_IATall_d
     /CLPARM=WALD ALPHA=.05 CLODDS=PL RSQUARE ; WEIGHT wgtamp;
RUN;
ODS HTML CLOSE;
